home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 641 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: chewy.vcx.net!usenet
  2. From: Bruce Arnold <barnold@vcx.net>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem with stringcopy
  5. Date: Mon, 08 Jan 1996 01:11:03 -0800
  6. Organization: Sprint United Telephone/Eastern - Internet @ccess
  7. Message-ID: <30F0DFA7.1D11@vcx.net>
  8. References: <4clguu$9fs@eagle.novo.dk> <yewvimppjz5.fsf@hyll.idt.unit.no> <4cmafq$bm5@clarknet.clark.net> <4co4mk$1pqi@news.gate.net>
  9. NNTP-Posting-Host: y-wing-2a-1.tatooine.vcx.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b2a (Windows; I; 16bit)
  14.  
  15. > In article <4cmafq$bm5@clarknet.clark.net>,
  16. >    eamick@clark.net (Eric Amick) wrote:
  17. > >Amund Tveit (amundt@pvv.unit.no) wrote:
  18. > >>[Morten Brun]
  19. > >>|   How do i do a partial stringcopy ....
  20. .......
  21. >         strncpy(destination,&source[startpos],max_length);
  22. .......
  23. The above solution looks good but don't forget that strncpy() doesn't
  24. terminate the string with a null in all cases.  Therefore an extra 
  25. statement is required:  destination[max_length] = 0;
  26.  
  27. Bruce.
  28.